package com.logic.handler;

import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.pjc.config.RpcReturnCode;
import com.pjc.thrift.TInnerProto;
import com.pjc.thrift.TLogicService;

/**
 * 协议分发
 * 
 * @author 王畅
 * @version 创建时间：2015-6-18 下午04:52:20
 */
public class ProtoHandler implements TLogicService.Iface {
	
	private static Logger log = LoggerFactory.getLogger(ProtoHandler.class);

	public int sendData(TInnerProto proto) throws TException {
		log.info("Recieive proto:" + proto.toString());
		try {
			return ProtoDispatcher.dispatchProto(proto);
		} catch (Exception ex) {
			log.error(ex.getMessage(), ex);
		}
		return RpcReturnCode.SYS_ERROR;
	}
}
